<script>

/**
 * Orders Component
 */
export default {
  data() {
    return {
      ordersData: [
        {
          serialNum: "1",
          code: "000014",
          abbreviation: "沙河股份",
          title: "2021年度业绩预告",
          announcementType: "业绩预告",
          enterprise: "-",
          date: "2022-01-27",
        },{
          serialNum: "2",
          code: "000014",
          abbreviation: "沙河股份",
          title: "深交所问询函",
          announcementType: "问询函",
          enterprise: "-",
          date: "2022-01-27",
        },{
          serialNum: "3",
          code: "000014",
          abbreviation: "沙河股份",
          title: "第十届董事会第十一次会议决议公告",
          announcementType: "董事会",
          enterprise: "深业沙河（集团）有限公司",
          date: "2022-01-08",
        }
      ],
      relevantOrdersData: [
        {
          serialNum: "1",
          code: "000835",
          abbreviation: "*ST长动",
          title: "长城国际动漫游戏股份有限公司章程(2021年12月修订)",
          announcementType: "公司治理",
          enterprise: "沙河实业股份有限公司 香港資源集團有限公司",
          date: "2021-12-31",
        },{
          serialNum: "2",
          code: "688220",
          abbreviation: "-",
          title: "翱捷科技首次公开发行股票并在科创板上市招股意向书附录",
          announcementType: "首发",
          enterprise: "宁波翾宇云芯企业管理合伙企业（有限合伙）",
          date: "2021-12-24",
        }
      ],
      totalRows: 100,
      currentPage: 1,
      relevantTotalRows: 100,
      relevantCurrentPage: 1,
      perPage: 10,
      fields: [
        { key: "serialNum", label: "序号" },
        { key: "code", label: "证券代码" },
        { key: "abbreviation", label: "证券简称" },
        { key: "title", label: "标题" },
        { key: "announcementType", label: "公告类型" },
        { key: "enterprise", label: "关联企业" },
        { key: "date", label: "日期" },
        { key: "operation", label: "操作" },
      ],
    };
  },
  watch: {
    "currentPage":{
      handler() {
        console.log("触发分页",this.currentPage);
      },
    }
  },
  mounted () {
    this.totalRows = this.ordersData.length
    this.relevantTotalRows = this.relevantOrdersData.length
  },
  methods: {
    onFiltered(v) {
      console.log(v);
      this.currentPage = 1;
    },
    // 详情
    toDetail(item){
      console.log(item);
      this.$router.push('/datahouse/securitiesAnnouncementDetail')
    },
    currentChange(v){
      console.log(v);
    },
  }
};
</script>

<template>
  <div>
    <!-- 搜索 -->
    <div class="search-box">
      <div class="position-relative search">
        <input type="text" class="form-control" placeholder="输入公告标题中含有的关键词" />
        <i class="mdi mdi-magnify search-icon"></i>
      </div>
    </div>
    <div class="allNum">
      <div class="searchNum">企业公告<span>961</span></div>
      <div style="display:flex;">
        <div style="margin-right: 20px;">
          <select class="form-control">
            <option>公告类型</option>
            <option>积极</option>
            <option>消极</option>
            <option>中性</option>
          </select>
        </div>
        <b-dropdown dropup variant="secondary" class="butn">
          <template slot="button-content">
            <i class="ri-add-line align-middle" style="font-size: 1rem;"></i>
            <span style="margin:0 20px 0 6px;">更多操作</span>
            <i class="mdi mdi-chevron-up"></i>
          </template>
          <b-dropdown-item-button>创建接口</b-dropdown-item-button>
          <b-dropdown-item-button>查看日志</b-dropdown-item-button>
          <b-dropdown-item-button>标准模式</b-dropdown-item-button>
          <b-dropdown-item-button>SQL模式</b-dropdown-item-button>
          <b-dropdown-item-button>数据字段</b-dropdown-item-button>
        </b-dropdown>
      </div>
    </div>
    <div>
      <b-table
        class="table-centered"
        :items="ordersData"
        :fields="fields"
        responsive="sm"
        :per-page="perPage"
        :current-page="1"
        thead-class="thead-light"
        @filtered="onFiltered"
      >
        <template v-slot:cell(operation)="row">
          <div class="pointer" @click="toDetail(row.item)">详情</div>
        </template>
      </b-table>
    </div>
    <div class="row">
      <div class="col">
        <div class="dataTables_paginate paging_simple_numbers float-right">
          <ul class="pagination pagination-rounded mb-0">
            <!-- pagination -->
            <b-pagination v-model="currentPage" :total-rows="totalRows" :per-page="perPage"></b-pagination>
          </ul>
        </div>
      </div>
    </div>
    <div class="allNum" style="margin-top:40px;">
      <div class="searchNum">相关公告<span>467</span></div>
      <div style="display:flex;">
        <div style="margin-right: 20px;">
          <select class="form-control">
            <option>情感分类</option>
            <option>积极</option>
            <option>消极</option>
            <option>中性</option>
          </select>
        </div>
        <b-dropdown dropup variant="secondary" class="butn">
          <template slot="button-content">
            <i class="ri-add-line align-middle" style="font-size: 1rem;"></i>
            <span style="margin:0 20px 0 6px;">更多操作</span>
            <i class="mdi mdi-chevron-up"></i>
          </template>
          <b-dropdown-item-button>创建接口</b-dropdown-item-button>
          <b-dropdown-item-button>查看日志</b-dropdown-item-button>
          <b-dropdown-item-button>标准模式</b-dropdown-item-button>
          <b-dropdown-item-button>SQL模式</b-dropdown-item-button>
          <b-dropdown-item-button>数据字段</b-dropdown-item-button>
        </b-dropdown>
      </div>
    </div>
    <div class="table-responsive">
      <b-table
        class="table-centered"
        :items="relevantOrdersData"
        :fields="fields"
        responsive="sm"
        :per-page="perPage"
        :current-page="1"
        thead-class="thead-light"
        @filtered="onFiltered"
      >
        <template v-slot:cell(operation)="row">
          <div class="pointer" @click="toDetail(row.item)">详情</div>
        </template>
      </b-table>
    </div>
    <div class="row">
      <div class="col">
        <div class="dataTables_paginate paging_simple_numbers float-right">
          <ul class="pagination pagination-rounded mb-0">
            <!-- pagination -->
            <b-pagination v-model="relevantCurrentPage" :total-rows="relevantTotalRows" :per-page="perPage"></b-pagination>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.search {
  max-width: 300px;
  margin-top: 20px;
  margin-bottom: 20px;
}
.border-radius{
  border-radius: 0px;
  border-bottom-left-radius: 30px;
  border-top-left-radius: 30px;
}
.right-dropdown{
  ::v-deep .btn{
    font-size: 0;
    border-radius: 0px;
    padding: 0.47rem 0.5rem;
    border-bottom-right-radius: 30px;
    border-top-right-radius: 30px;
    i{
      font-size: 0.9rem;
      vertical-align: middle;
    }
  }
}
.table-centered{
  ::v-deep thead,::v-deep tbody{
    tr{
      th:last-child,td:last-child{
        text-align: right;
      }
    }
  }
  ::v-deep tbody{
    tr{
      td{
        font-size: 13px;
      }
    }
  }
}
.allNum{
  padding-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.searchNum{
  span{
    font-size: 1rem;
    color: #3444c1;
    margin: 0 4px;
    font-weight: 600;
  }
}
.butn{
  ::v-deep .btn{
    background-color: #252b3b;
    border-color: #252b3b;
    border-radius: 30px;
    display: flex;
    align-items: center;
  }
  ::v-deep .btn-secondary.focus {
    box-shadow: 0 0 0 0.15rem rgb(37 40 58 / 50%);
  }
}
</style>

